import { computed, ref, watchEffect, watch } from 'vue'

function useCount() {
  const count = ref(1)

  const doubleCount = computed(() => {
    return count.value * 2
  })

  watchEffect(() => {
    // console.log(count.value)
  })

  watch(() => {
    return count.value
  }, (count) => {
    console.log(count)
  })

  setTimeout(() => {
    count.value += 100
  }, 3000)

  return {
    count,
    doubleCount
  }
}

export default useCount